<template>
<view  >
	<view class="movie-info" v-for="item in info" >
		<video :src="item.video_url" controls class="video" ></video>
		<!-- 标题start -->
		<view class="title-waper">
			<image :src="item.poster_url"   class="cover" @click="goCover(item.id)"></image>
			<view class="title-right">
				<view class="title">{{item.title}}</view>
				<view class="classify">{{item.category}}</view>
				<view class="duration">影片时长：{{item.duration}}分钟</view>
				<view class="add-time">上映时间：{{item.add_time}}（中国大陆）</view>
				<view class="score-box">
					<view class="score">
						综合评分:<text class="score-num">{{item.garde.length==1?item.garde : item.garde+".0"}}</text>
					</view>
					<view class="star">
						<star :score="item.garde"></star>
						<text>{{item.praise}} 人点赞</text>
					</view>
				</view>
			</view>
		</view>
		<!-- 标题end -->
		
		<!-- /* 剧情介绍 */ -->
		<view class="introduce">
			<view class="subtitle">剧情介绍</view>
			<view class="introduce-content">
				{{item.synopsis}}
			</view>
		</view>
		<!-- /* 剧情介绍 */ -->
		
		<!-- 演职人员start -->
		<view class="actor">
			<view class="subtitle">演职人员</view>
			<scroll-view scroll-x="true" >
				<view class="actor-scroll">
					<view class="actor-scroll-item" v-for="item in 8">
						<image 
						src="https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1917853737,154946821&fm=26&gp=0.jpg" 
						class="actor-photo"
						mode="aspectFill" 
						@click="lookme()"></image>
						<view class="actor-name">
							王昭君dwadwadwd
						</view>
						<view class="actor-profession">
							演员
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<!-- 演职人员end -->
		
		<view class="stills">
			<view class="subtitle">剧照</view>
			<scroll-view scroll-x="true" >
				<view class="stills-scroll">
					<image 
					v-for="item in 8" 
					class="stills-item" 
					src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1346711909,1199089208&fm=26&gp=0.jpg" 
					mode="aspectFill"
					@click="lookme()"
					></image>
				</view>
			</scroll-view>
		</view>
	</view>
</view>
</template>

<script>
	import star from '../../components/star.vue'
	export default {
		data() {
			return {
				id:null,
				info:[]
			}
		},
		async onLoad(parmas) {
			this.id=parmas.id
			this.getMovieInfo()
		},
		// #ifndef H5
		onNavigationBarButtonTap({index}) {
			if(index==0){
				uni.share({
				    provider: "weixin",
				    scene: "WXSceneSession",
				    type: 0,
				    href: "http://uniapp.dcloud.io/",
				    title: "uni-app分享",
				    summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
				    imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
				    success: function (res) {
				        console.log("success:" + JSON.stringify(res));
				    },
				    fail: function (err) {
				        console.log("fail:" + JSON.stringify(err));
				    }
				});
			}
		},
		// #endif
		onShareAppMessage() {
			let me=this
			return {
			      title:me.info[0].title ,
			      path: '/pages/movieInfo/movieInfo?id='+me.info[0].id
			}
		},
		methods: {
			lookme(){
				uni.previewImage({
					urls:['https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1917853737,154946821&fm=26&gp=0.jpg','https://dss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1917853737,154946821&fm=26&gp=0.jpg']
				})
			},
			goCover(id){
				uni.navigateTo({
					url:`../cover/cover?id=${id}`
				})
			},
			getMovieInfo(){
				uni.request({
					url:this.root+'/api/getMovieInfo/'+this.id,
					success:(res)=>{
						if(res.data.err==0){
							this.info=res.data.data
						}
					}
				})
			}
		},
		components:{star},
	}
</script>

<style scoped>
@import url("movieInfo.css");
</style>
